package com.ruitu.health.adapter;

import android.content.Context;
import android.widget.ImageView;
import android.widget.RelativeLayout;

import com.ruitu.arad.base.base_list.ListBaseAdapter;
import com.ruitu.arad.base.base_list.SuperViewHolder;
import com.ruitu.arad.util.ScreenUtils;
import com.ruitu.arad.util.SizeUtils;
import com.ruitu.health.R;
import com.ruitu.router_module.bean.product.ProHome;

/**
 * Created by Administrator on 2018/3/27.
 * 首页底部商品列表adapter
 */
public class DataAdapter extends ListBaseAdapter<ProHome> {
    public DataAdapter(Context context) {
        super(context);
    }

    @Override
    public int getLayoutId() {
        return R.layout.app_item_home_model_pro;
    }

    @Override
    public void onBindItemHolder(SuperViewHolder holder, int position) {
        ImageView icon = holder.getView(R.id.icon);// 商品的图片

        int width = ScreenUtils.getScreenWidth();
        int itemWidth = (width - SizeUtils.dp2px(30)) / 2;

        RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) icon.getLayoutParams();
        params.width = itemWidth;
        params.height = itemWidth * 10 / 16;
        icon.setLayoutParams(params);

    }
}

